package com.mvvm.store.roombatabase;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.mvvm.store.bean.basebean.StockUpInfoBean;

import java.util.List;

/**
 * 备货本地数据库   订单
 */
@Dao
public interface StockUpInfoDao {
    //查询所有的物料信息
    @Query("SELECT * FROM StockUpInfoBean")
    List<StockUpInfoBean> getAll();

    //根据扫码的订单号,零件号 查询对于的该订单信息
    @Query("SELECT * FROM StockUpInfoBean WHERE orderNumber=:orderNumber AND oddNumber=:oddNumber" )
    List<StockUpInfoBean> getStockUpInfoByOddNumber(String orderNumber,String oddNumber);

    //根据订单号查询对应的零件列表数据
    @Query("SELECT * FROM StockUpInfoBean WHERE orderNumber=:orderNumber" )
    List<StockUpInfoBean> getStockUpInfoByOrderNumber(String orderNumber);

    //根据订单号查询对应的零件列表数据
    @Query("SELECT * FROM StockUpInfoBean WHERE oddNumber=:oddNumber" )
    List<StockUpInfoBean> getStockUpInfoByOddNumber(String oddNumber);

    //新增扫码数据
    @Insert
    void insertAll(StockUpInfoBean... stockUpInfoBean);

    //修改单挑记录
    @Update
    void updateStudent(StockUpInfoBean... users);


    //删除对于的备案数据
    @Delete
    void delete(StockUpInfoBean user);


    //根据id查询对于的物料信息
    @Query("SELECT *FROM StockUpInfoBean WHERE sId=:sId")
    List<StockUpInfoBean> getStockUpInfoById(int sId);
}
